package commons.interceptor.configuration;

import commons.interceptor.PermsInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Author zhangyong
 * @Date 2021/8/6 0006上午 10:28
 */
@Configuration
public class PermsInterceptorConfiguration implements WebMvcConfigurer {

    @Resource
    private PermsInterceptor permsInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截所有请求
        registry.addInterceptor(permsInterceptor).addPathPatterns("/**");
    }
}
